import { RouteRecordRaw } from "vue-router";
import * as api from "@/apis";
export { api };

export const isMenuItem = (route: RouteRecordRaw) =>
  !route.children || route.children.filter((item) => item.meta?.icon).length == 0;
export const isRouteActive = (routeItem: RouteRecordRaw) => {
  const route = useRoute();
  if (routeItem.name == route.name) return true;
  else if (Array.isArray(routeItem.children)) {
    return routeItem.children.some((item) => isRouteActive(item));
  } else return false;
};
